<script src="/parkinfo/js/jquery-1.7.2.min.js"></script>
<script src="/parkinfo/js/jquery.min.js"></script>
<link href="/parkinfo/css/bootstrap.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="/parkinfo/dist/css/AdminLTE.css">
<link rel="stylesheet" href="/parkinfo/dist/css/skins/skin-blue.min.css">
<link href="/parkinfo/datepicker/datepicker.css" rel="stylesheet"/>
<link href="/parkinfo/css/xx_list_admin.css" rel="stylesheet"/>
<script src="/parkinfo/angular/angular.min.js"></script>
<script src="/parkinfo/angular/angular-animate.min.js"></script>
<script src="/parkinfo/angular/angular-cookies.min.js"></script>
<script src="/parkinfo/angular/angular-ui-router.min.js"></script>
<script src="/parkinfo/angular/ocLazyLoad.min.js"></script>
<script src="/parkinfo/angular/ui-bootstrap-tpls.min.js"></script>
<script src="/parkinfo/js/monthUser.js?v=1.3"></script>
<script src="/parkinfo/js/bootstrap.min.js"></script>
<script src="/parkinfo/js/utility.js"></script>
<script src="/parkinfo/script/datepicker.js"></script>
<script src="/parkinfo/js/service/textModalService.js"></script>
<script src="/parkinfo/js/jquery.form.js"></script>
<script src="/parkinfo/script/tm.pagination.js"></script>
<script src="/parkinfo/js/monthUser2.js"></script>
<!-- <script src="/parkinfo/script/reconciliation.js"></script> -->
<style>
        .page-list .pagination {float:left;}
        .page-list .pagination span {cursor: pointer;}
        .page-list .pagination .separate span{cursor: default; border-top:none;border-bottom:none;}
        .page-list .pagination .separate span:hover {background: none;}
        .page-list .page-total {float:left; margin: 25px 20px;}
        .page-list .page-total input, .page-list .page-total select{height: 26px; border: 1px solid #ddd;}
        .page-list .page-total input {width: 40px; padding-left:3px;}
        .page-list .page-total select {width: 50px;}
</style>
<script type="text/javascript">
var User = function(){  
    this.init = function(){  
          
        //模拟上传excel  
         $("#uploadEventBtn").unbind("click").bind("click",function(){  
             $("#uploadEventFile").click();  
         });  
         $("#uploadEventFile").bind("change",function(){  
             $("#uploadEventPath").attr("value",$("#uploadEventFile").val());  
         });  
          
    };  
    //点击上传按钮  
    this.uploadBtn = function(){  
        var uploadEventFile = $("#uploadEventFile").val();  
        if(uploadEventFile == ''){  
            alert("请选择excel,再上传");  
        }else if(uploadEventFile.lastIndexOf(".xls")<0){//可判断以.xls和.xlsx结尾的excel  
            alert("只能上传Excel文件");  
        }else{  
            var url =  '/parkinfo/user/upload';  
            var formData = new FormData($('form')[0]);  
            user.sendAjaxRequest(url,'POST',formData);  
        }  
    };  
      
    this.sendAjaxRequest = function(url,type,data){  
        $.ajax({  
            url : url,  
            type : type,  
            data : data,  
            success : function(result) {  
                alert( "excel上传成功");  
            },  
            error : function() {  
                alert( "excel上传失败");  
            },  
            cache : false,  
            contentType : false,  
            processData : false  
        });  
    };  
}  
      
var user;  
$(function(){  
    user = new User();  
    user.init();  
});
</script>


<div class="" ng-app="monthUserApp" ng-controller="monthUserCtrl">
    <section class="content-header">
        <h1> 月卡用户管理 <small></small></h1>
    </section>

    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <!-- <div class="box-header">
                        <h3 class="box-title"></h3>
                    </div> -->
                    <div class="box-body">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="panel panel-primary">
                                    <div class="panel-heading">
                                        <h3 class="panel-title"> 月卡用户查找及导出 </h3>
                                    </div>
                                    <div class="panel-body">
                                        <div class="row" style="height: 50px;">
                                            <div class="col-md-1">
                                                <label class="control-label" style="float:right;padding-top:10px;">关键字:</label>
                                            </div>

                                            <div class="col-md-2">
                                                <input type="text"  ng-model="searchText" class="form-control text" style="float:right">
                                            </div>

                                            <div class="col-md-1">
                                                <button  type="button" class="btn btn-info" ng-click="searchByPlateNumber()" style="float:left">
                                                    查找
                                                </button>
                                            </div>
                                            
                                            
                                           <!-- <div class="col-md-1">
                                           <button class="btn btn-success btn-xs" id="uploadEventBtn" style="height:33px;margin-left: 0px;"  type="button" >选择文件</button>
                                            </div>
                                            <form enctype="multipart/form-data" id="batchUpload"  action="/user/addExcelpark" method="post" class="form-horizontal">    
											    <input type="file" name="file"  style="width:0px;height:0px;" id="uploadEventFile">  
											    <input id="uploadEventFile" type="file" name="file" accept="xlsx" style="width:0px;height:0px;"/>
											    <input id="uploadEventPath"  disabled="disabled"  type="text" placeholder="请选择excel表" style="border: 1px solid #e6e6e6; height: 35px;width: 223px;margin-left: 15px;" >                                           
											</form>  
											<div class="col-md-1">
                                                <button type="button" class="btn btn-info" onclick="parkexp.uploadBtn()" style="margin-top: -50px;margin-left: 676px;">上传</button>
                                            </div> -->
                                            
                                            <div class="col-md-1">
                                            	<button class="btn btn-success btn-xs" id="uploadEventBtn" style="height:33px;margin-left: 85px;"  type="button" >选择文件</button>
											</div>
											<form enctype="multipart/form-data" id="batchUpload"  action="user/upload" method="post" class="form-horizontal">    
												    <input type="file" name="file"  style="width:0px;height:0px;" id="uploadEventFile">  
												    <input id="uploadEventPath"  disabled="disabled"  type="text" placeholder="请选择excel表" style="border: 1px solid #e6e6e6; height: 33px;width: 140px;margin-left: 100px;" >                                           
											</form>
											<div class="col-md-2">
												<button type="button" class="btn btn-info"  onclick="user.uploadBtn()" style="margin-top: -45px;margin-left: 675px;height: 33px;width: 55px;" >导入</button>
											</div>
											
											
                                            <!-- <div class="col-md-4">
                                            <select id="park-select" class="form-control" style="font-weight:bold;width: 220.5px;float: right;">
                                            #foreach( $park in $parks)
                                            <option value=$park.id>$park.name</option>
                                            #end
                                            </select>
                                            </div>
                                            <div class="col-md-2">
                                            <button id="excelBtn" ng-click="getExcelByParkRange()" type="button" class="btn btn-info"> 导出</button>
                                            </div> -->
                                            <div class="col-md-1" hidden>
                                                <button ng-click="getExcelByDay()" type="button" class="btn bg-purple">
                                                    所有停车场
                                                </button>
                                            </div>
                                        </div>

                                        <div class="row" style="padding-top:20px" >

                                            <div class="col-md-1">
                                                <label class="label-control" style="float:right;padding-top:10px"> 时间段:</label>
                                            </div>
                                            <div class="col-md-2">
                                                <input type="text" id="date" ng-model="startDate" class="form-control date">
                                            </div>

                                            <div class="col-md-2">
                                                <input type="text" id="date" ng-model="endDate" class="form-control date">
                                            </div>
                                            <div class="col-md-3">
                                                <select class="form-control" style="padding:1px;font-size:14px;height:35px" ng-options="park.id as park.name for park in parks" ng-model="selectedParkidd" >
                                                    #if($isAdmin) <option value=-1>所有停车场</option>#end
                                                </select>
                                            </div>
                                            <!-- <div class="col-md-3">
			                                    <select id="park-select2" class="form-control" style="font-weight:bold">
			                                            #foreach( $park in $parks)
			                                                <option value=$park.id>$park.name</option>
			                                            #end
			                                     </select>
			                                </div> -->

                                            <div class="col-md-2">
                                                <button id="excelBtn" ng-click="getExcel()" type="button" class="btn btn-info">
                                                    导出
                                                </button>
                                            </div>
                                            
                                            <div class="col-md-1" hidden>
                                                <button  type="button" class="btn btn-info" ng-click="getExcelByDayRange()" style="float:left">
                                                    所有停车场
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <!-- <div class="box-body">  -->
                                <div class="btn-group">
                                    <button  ng-click="refreshUser()" type="button" class="btn bg-purple">
                                        <span class="glyphicon glyphicon-refresh"></span> 刷新
                                    </button>
                                    <button   ng-click="insertUser()" type="button" class="btn bg-olive">
                                        <span class="glyphicon glyphicon-pencil"></span> 用户开卡
                                    </button>
                                    <button  ng-click="updateUser()" type="button" class="btn bg-navy">
                                        <span class="glyphicon glyphicon-edit"></span> 月卡续费
                                    </button>
                                    <button   ng-click="deleteUser()" type="button" class="btn  bg-orange">
                                        <span class="glyphicon glyphicon-remove"></span> 删除用户
                                    </button>
                                    <button  ng-click="updateUserPark()" type="button" class="btn  bg-olive">
                                        <span class="glyphicon glyphicon-edit"></span> 所属停车场
                                    </button>
                                </div>
                                
                                <!-- <div class="pull-right">

                                <select class="form-control" style="padding:1px;font-size:14px;height:35px" ng-options="park.id as park.name for park in parks" ng-model="selectedParkid" ng-change="selectChanged(selectedParkid)">
                                #if($isAdmin) <option value=-1>所有停车场</option>#end
                                </select>
                                </div> -->
                                <div class="pull-right">
                                    <select style="display:none" id="get_Park" class="form-control" style="padding:1px;font-size:14px;height:35px" id="searchPark">
                                        #foreach( $park in $parks)
                                        <option value=$park.id>$park.name</option>
                                        #end
                                    </select>
                                    <select class="form-control" style="padding:1px;font-size:14px;height:35px" ng-options="park.id as park.name for park in parks" ng-model="selectedParkid" ng-change="selectChanged(selectedParkid)">
                                        <option value="">请选择</option>
                                        #if($isAdmin) <option value=-1>所有停车场</option>#end
                                    </select>
                                </div>

                                <br/>
                                <br/>
                                <div>
                                    <table class="table table-bordered table-hover table-condensed" style="font-size:12px">
                                        <tr>
                                            <th><span style="">
                                                <input type="checkbox" />
                                </div></th>
                                <th hidden><span style="padding-left:15%">Id
                            </div></th>
                            <th style="width:170px;"><span style="padding-left:15%">停车场名
                        </div></th>
                        <th hidden><span style="padding-left:15%" >楼层
                    </div></th>
                    <th><span style="padding-left:15%">车主
                </div></th>
                <th><span style="padding-left:15%">车牌号
            </div></th>
            <!-- <th><span style="padding-left:15%">车位号
            </div></th> -->
            <th hidden><span style="padding-left:15%" >车牌颜色
        </div></th>
        <th><span style="padding-left:15%">描述
</div></th>
<th><span style="padding-left:15%">类型
</div></th>
<th hidden><span style="padding-left:15%" >电话号码</div></th>
<th><span style="padding-left:15%">开始时间</div></th>
<th><span style="padding-left:15%">结束时间</div></th>
<th hidden><span style="padding-left:15%" >支付金额</div></th>
<!-- <th><span style="padding-left:15%">状态</div></th> -->
</tr>

<tbody id="parkBody"></tbody>
<tr ng-repeat="user in users">
    <td >
    <input type="checkbox" ng-model="user.checked" ng-click="selectChange($index)"/>
    </td>
    <td ng-bind="user.id" hidden></td>
    <td ng-bind="user.parkname"></td>
    <td ng-bind="user.owner"></td>
    <!-- <td ng-bind="user.cardnumber"></td> -->
    <td ng-bind="user.platenumber"></td>
    <td ng-bind="user.certificatenumber" hidden></td>
    <td ng-bind="user.platecolor" hidden></td>
    <td ng-bind="user.certificatetype"></td>
    <td ng-if="user.type==0">包月用户</td>
    <td ng-if="user.type==1">预约</td>
    <td ng-if="user.type==2">预约</td>
    <td ng-if="user.type==3">预约</td>
    <td ng-if="user.type==4">预约</td>
    <td ng-if="user.type==9">临停</td>
    <td ng-bind="user.certificatenumber" hidden></td>
    <td ng-bind="user.starttime"></td>
    <td ng-bind="user.endtime"></td>
    <td ng-bind="user.payment | currency:'￥'" hidden></td>
    <!-- <td ng-if="user.status==1">已支付</td>
    <td ng-if="user.status==0">未支付</td> -->
</tr>
</table>
<tm-pagination conf="paginationConf"></tm-pagination>
</div>
<div class="box-footer clearfix">
    <div id='pagination'></div>
</div>
</div>
</div>
</div>
</section>


<script  type="text/ng-template" id="modifyUser2">
<div class="modal-header">
    <button type='button' class='close' ng-click="close()" aria-hidden='true'>
        &times;
    </button>
    <h4 class="modal-title" >月卡用户附属停车场设置</h4>

</div>

<div class="modal-body">
     <form class="form-horizontal" role="form">     
        <div class="form-group">
            <label class="col-sm-2 control-label" >所属市</label>
            <div class="col-sm-8">
                <select class="form-control" ng-options="zoneCenter.id as zoneCenter.name for zoneCenter in zoneCenters" ng-model="zoneCenterId" ng-change="getArea(zoneCenterId)"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" >所属区</label>
            <div class="col-sm-8">
                <select class="form-control" ng-options="area.id as area.name for area in areas"  ng-change="getStreets(areaId)" ng-model="areaId"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" >所属路段</label>
            <div class="col-sm-8">
                <select class="form-control" ng-options="street.id as street.name for street in streets" ng-model="tempPos.streetid" ng-change="getParks(tempPos.streetid)"></select>
            </div>
        </div>
         <div class="form-group">
            <label class="col-sm-2 control-label" >停车场</label>
            <div class="col-sm-8">
                <select class="form-control" ng-options="park.id as park.name for park in parks" ng-model="parkid"></select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" >附属停车场</label>
            <div class="col-sm-8">
              <textarea rows=5 class="form-control" ng-model=parkNames></textarea>
            </div>
        </div>
   </form>   
     <div class="alert alert-info" ng-show="loading || submitted">
            <span  ng-show='loading' > <i class="fa fa-spinner"></i></span>
            <span ng-show='submitted'>{{result}}</span>
     </div>  
 </div>
 <div class="modal-footer">
    
    <button ng-click="add()"  type="button" class="btn btn-primary">
        增加
    </button>
    <button ng-click="deletePark()"  type="button" class="btn btn-primary">
        删除
    </button>
    <button ng-click="close()" type="button" class="btn btn-default" data-dismiss="modal">
        关闭
    </button>
</div>
</script>

<script  type="text/ng-template" id="modifyUser">

    <div class="modal-header">
    <button type='button' class='close' ng-click="close()" aria-hidden='true'>
    &times;
    </button>
    <h4 class="modal-title" >月卡缴费</h4>

    </div>

    <div class="modal-body">
    <form class="form-horizontal" role="form" name="myForm">

    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">停车场 *</label>
    <div class="col-sm-8">
    <select class="form-control" ng-options="park.id as park.name for park in parks" ng-model="tempUser.parkid"></select>
    </div>
    </div>
    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">车牌号 *</label>
    <div class="col-sm-8">
    <input type="text" name="platenumber" class="form-control" placeholder="请输入车牌号" ng-model="tempUser.platenumber" required>
    </div>
	<!--<span style="color:red;" ng-show="myForm.platenumber.$pristine && myForm.platenumber.$invalid">
	<span ng-show="myForm.platenumber.$error.required">车牌不能为空！</span>-->
    </div>
	<!--<div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">车位号 *</label>
    <div class="col-sm-8">
    <input type="text" name="certificatenumber" class="form-control" placeholder="请输入车位号" ng-model="tempUser.certificatenumber" required>
    </div>
	<span style="color:red;" ng-show="myForm.certificatenumber.$pristine && myForm.certificatenumber.$invalid">
	<span ng-show="myForm.certificatenumber.$error.required">车位不能为空！</span>
    </div>-->
    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">车主 *</label>
    <div class="col-sm-8">
    <input type="text" name="owenr" class="form-control" placeholder="请输入车主姓名" ng-model="tempUser.owner" required>
    </div>
	<!--<span style="color:red;" ng-show="myForm.owenr.$pristine && myForm.owenr.$invalid">
	<span ng-show="myForm.owenr.$error.required">车主不能为空！</span>-->
    </div>

    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">开始时间 *</label>
    <div class="col-sm-8">
    <input type="text" class="form-control" placeholder="YYYY-MM-DD hh:mm:ss" ng-model="tempUser.starttime">
    </div>
    </div>
    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">结束时间 </label>
    <div class="col-sm-8">
    <input type="text" class="form-control" placeholder="YYYY-MM-DD hh:mm:ss" ng-model="tempUser.endtime">
    </div>
    </div>

    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">类型</label>
    <div class="col-sm-8">
    <select ng-model="tempUser.type" ng-options="status.value as status.text for status in orderTypes" class="form-control">
    </select>
      </div>
      </div>

    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">描述</label>
    <div class="col-sm-8" >
    <input type="text" name="miaoshu" class="form-control" placeholder="请输入描述" style="" ng-model="tempUser.certificatetype" required>
	</div>
	<!--<span style="color:red;" ng-show="myForm.miaoshu.$pristine && myForm.miaoshu.$invalid">
	<span ng-show="myForm.miaoshu.$error.required">描述不能为空！</span>-->
    </div>
    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;" >楼层/车位号</label>
    <div class="col-sm-8">
    <input type="text" class="form-control" placeholder="请输入楼层" ng-model="tempUser.cardnumber">
    </div>
    </div>
    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">电话号码</label>
    <div class="col-sm-8">
    <input type="text" class="form-control" placeholder="请输入证件号码" ng-model="tempUser.certificatenumber">
    </div>
    </div>
    <!--<div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">车牌颜色</label>
    <div class="col-sm-8">
    <input type="text" class="form-control" placeholder="请输入车牌颜色" ng-model="tempUser.platecolor">
    </div>
    </div>-->
    <div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">支付金额</label>
    <div class="col-sm-8">
    <input type="text" class="form-control" placeholder="请输入支付金额" ng-model="tempUser.payment">
    </div>
    </div>
    <!--<div class="form-group">
    <label class="col-sm-2 control-label" style="width:105px;">状态</label>
    <div class="col-sm-8">
    <select ng-model="tempUser.status" ng-options="status.value as status.text for status in statuses" class="form-control">
    </select>
    </div>
    </div>-->
    <div class="alert alert-info" ng-show="(showResult || showLoader)">
    <span  ng-show='showLoader'  skip-ng-show= "yes" ng-activity-indicator= "CircledGrey"></span>
    <span ng-show='showResult'>{{result}}</span>
    </div>

    </form>
    </div>

    <div class="modal-footer">
    <button ng-click="close()" type="button" class="btn btn-default" data-dismiss="modal">
    取消
    </button>
    <button ng-click="submit()" type="submit" class="btn btn-primary">
    确定
    </button>
    </div>
</script>

</div>